<?php

class server extends main
{
    function __construct()
    {
        parent::__construct();
    }

    public function getArray()
    {
        $model = $_POST["model"] ? $_POST["model"] : $_GET["model"];
        $action = $_POST["action"] ? $_POST["action"] : $_GET["action"];
        $filename = APP_ROOT . '/api/' . $model . '.php';
        require_once $filename;
        $objControl = new $model();
        try {
            $returnArray = $objControl->$action($model, $action);
        } catch (exception $e) {
            $returnArray["code"] = 0;
            $returnArray["msg"] = "系统错误,请稍后重试.....";
        }
        echo json_encode($returnArray);
    }
}

?>